package com.itcast.bos.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itcast.bos.dao.CourierRepository;
import com.itcast.bos.domain.Courier;
import com.itcast.bos.service.CourierService;
@Service

public class CourierServiceImpl implements CourierService{
	@Autowired
	private CourierRepository courierResitory;
	
	@Override
	@Transactional
	public void save(Courier courier) {
		courierResitory.save(courier);
		
	}

	@Override
	public List<Courier> findAll() {
		// TODO Auto-generated method stub
		return courierResitory.findAll();
	}



	@Override
	
	public Page<Courier> findpage(Specification<Courier> specification,
			Pageable pageable) {
		// TODO Auto-generated method stub
		return courierResitory.findAll(specification,pageable);
	}

	@Override
	@Transactional
	public void delBatch(String[] idArray) {
		for (String idStr : idArray) {
		Integer id=	Integer.parseInt(idStr);
		courierResitory.updateDelTag(id);
		}
		
	}

}
